//
//  RomUtil.m
//  officeServiceApp
//
//  Created by mac on 2021/1/19.
//

#import "RomUtil.h"
#import <sys/utsname.h>//要导入头文件
@implementation RomUtil
//https://blog.csdn.net/qq_19926599/article/details/86747401

+ (NSString *)getCurrentDeviceModel{
   struct utsname systemInfo;
   uname(&systemInfo);
   
   NSString *deviceModel = [NSString stringWithCString:systemInfo.machine encoding:NSASCIIStringEncoding];
   
if ([deviceModel isEqualToString:@"i386"])         return @"Simulator";
if ([deviceModel isEqualToString:@"x86_64"])       return @"Simulator";
if ([deviceModel isEqualToString:@"arm64"])       return @"iPhone Simulator";
if ([deviceModel isEqualToString:@"iPhone1,1"])    return @"iPhone";
if ([deviceModel isEqualToString:@"iPhone1,2"])    return @"iPhone 3G";
if ([deviceModel isEqualToString:@"iPhone2,1"])    return @"iPhone 3GS";
if ([deviceModel isEqualToString:@"iPhone3,1"])    return @"iPhone 4";
if ([deviceModel isEqualToString:@"iPhone3,2"])    return @"iPhone 4 GSM Rev A";
if ([deviceModel isEqualToString:@"iPhone3,3"])    return @"iPhone 4 CDMA";
if ([deviceModel isEqualToString:@"iPhone4,1"])    return @"iPhone 4S";
if ([deviceModel isEqualToString:@"iPhone5,1"])    return @"iPhone 5 (GSM)";
if ([deviceModel isEqualToString:@"iPhone5,2"])    return @"iPhone 5 (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPhone5,3"])    return @"iPhone 5C (GSM)";
if ([deviceModel isEqualToString:@"iPhone5,4"])    return @"iPhone 5C (Global)";
if ([deviceModel isEqualToString:@"iPhone6,1"])    return @"iPhone 5S (GSM)";
if ([deviceModel isEqualToString:@"iPhone6,2"])    return @"iPhone 5S (Global)";
if ([deviceModel isEqualToString:@"iPhone7,1"])    return @"iPhone 6 Plus";
if ([deviceModel isEqualToString:@"iPhone7,2"])    return @"iPhone 6";
if ([deviceModel isEqualToString:@"iPhone8,1"])    return @"iPhone 6s";
if ([deviceModel isEqualToString:@"iPhone8,2"])    return @"iPhone 6s Plus";
if ([deviceModel isEqualToString:@"iPhone8,3"])    return @"iPhone SE (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPhone8,4"])    return @"iPhone SE (GSM)";
if ([deviceModel isEqualToString:@"iPhone9,1"])    return @"iPhone 7";
if ([deviceModel isEqualToString:@"iPhone9,2"])    return @"iPhone 7 Plus";
if ([deviceModel isEqualToString:@"iPhone9,3"])    return @"iPhone 7";
if ([deviceModel isEqualToString:@"iPhone9,4"])    return @"iPhone 7 Plus";
if ([deviceModel isEqualToString:@"iPhone10,1"])    return @"iPhone 8";
if ([deviceModel isEqualToString:@"iPhone10,2"])    return @"iPhone 8 Plus";
if ([deviceModel isEqualToString:@"iPhone10,3"])    return @"iPhone X Global";
if ([deviceModel isEqualToString:@"iPhone10,4"])    return @"iPhone 8";
if ([deviceModel isEqualToString:@"iPhone10,5"])    return @"iPhone 8 Plus";
if ([deviceModel isEqualToString:@"iPhone10,6"])    return @"iPhone X GSM";
if ([deviceModel isEqualToString:@"iPhone11,2"])    return @"iPhone XS";
if ([deviceModel isEqualToString:@"iPhone11,4"])    return @"iPhone XS Max China";
if ([deviceModel isEqualToString:@"iPhone11,6"])    return @"iPhone XS Max";
if ([deviceModel isEqualToString:@"iPhone11,8"])    return @"iPhone XR";
if ([deviceModel isEqualToString:@"iPhone12,1"])    return @"iPhone 11";
if ([deviceModel isEqualToString:@"iPhone12,3"])    return @"iPhone 11 Pro";
if ([deviceModel isEqualToString:@"iPhone12,5"])    return @"iPhone 11 Pro Max";
if ([deviceModel isEqualToString:@"iPhone12,8"])    return @"iPhone SE 2nd Gen";
if ([deviceModel isEqualToString:@"iPhone13,1"])    return @"iPhone 12 Mini";
if ([deviceModel isEqualToString:@"iPhone13,2"])    return @"iPhone 12";
if ([deviceModel isEqualToString:@"iPhone13,3"])    return @"iPhone 12 Pro";
if ([deviceModel isEqualToString:@"iPhone13,4"])    return @"iPhone 12 Pro Max";
if ([deviceModel isEqualToString:@"iPhone14,2"])    return @"iPhone 13 Pro";
if ([deviceModel isEqualToString:@"iPhone14,3"])    return @"iPhone 13 Pro Max";
if ([deviceModel isEqualToString:@"iPhone14,4"])    return @"iPhone 13 Mini";
if ([deviceModel isEqualToString:@"iPhone14,5"])    return @"iPhone 13";
if ([deviceModel isEqualToString:@"iPhone14,6"])    return @"iPhone SE (3rd generation)";

//
if ([deviceModel isEqualToString:@"iPod1,1"])      return @"iPod Touch 1G";
if ([deviceModel isEqualToString:@"iPod2,1"])      return @"iPod Touch 2G";
if ([deviceModel isEqualToString:@"iPod3,1"])      return @"iPod Touch 3G";
if ([deviceModel isEqualToString:@"iPod4,1"])      return @"iPod Touch 4G";
if ([deviceModel isEqualToString:@"iPod5,1"])      return @"iPod Touch (5 Gen)";
if ([deviceModel isEqualToString:@"iPod7,1"])      return @"6th Gen iPod";
if ([deviceModel isEqualToString:@"iPod9,1"])      return @"7th Gen iPod";

//
if ([deviceModel isEqualToString:@"iPad1,1"])      return @"iPad";
if ([deviceModel isEqualToString:@"iPad1,2"])      return @"iPad 3G";
if ([deviceModel isEqualToString:@"iPad2,1"])      return @"2nd Gen iPad";
if ([deviceModel isEqualToString:@"iPad2,2"])      return @"2nd Gen iPad GSM";
if ([deviceModel isEqualToString:@"iPad2,3"])      return @"2nd Gen iPad CDMA";
if ([deviceModel isEqualToString:@"iPad2,4"])      return @"2nd Gen iPad New Revision";
if ([deviceModel isEqualToString:@"iPad3,1"])      return @"3rd Gen iPad";
if ([deviceModel isEqualToString:@"iPad3,2"])      return @"3rd Gen iPad CDMA";
if ([deviceModel isEqualToString:@"iPad3,3"])      return @"3rd Gen iPad GSM";
if ([deviceModel isEqualToString:@"iPad2,5"])      return @"iPad mini";
if ([deviceModel isEqualToString:@"iPad2,6"])      return @"iPad mini GSM+LTE";
if ([deviceModel isEqualToString:@"iPad2,7"])      return @"iPad mini CDMA+LTE";
if ([deviceModel isEqualToString:@"iPad3,4"])      return @"4th Gen iPad";
if ([deviceModel isEqualToString:@"iPad3,5"])      return @"4th Gen iPad GSM+LTE";
if ([deviceModel isEqualToString:@"iPad3,6"])      return @"4th Gen iPad CDMA+LTE";
if ([deviceModel isEqualToString:@"iPad4,1"])      return @"iPad Air (WiFi)";
if ([deviceModel isEqualToString:@"iPad4,2"])      return @"iPad Air (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPad4,3"])      return @"1st Gen iPad Air (China)";
if ([deviceModel isEqualToString:@"iPad4,4"])      return @"iPad mini Retina (WiFi)";
if ([deviceModel isEqualToString:@"iPad4,5"])      return @"iPad mini Retina (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPad4,6"])      return @"iPad mini Retina (China)";
if ([deviceModel isEqualToString:@"iPad4,7"])      return @"iPad mini 3 (WiFi)";
if ([deviceModel isEqualToString:@"iPad4,8"])      return @"iPad mini 3 (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPad4,9"])      return @"iPad Mini 3 (China)";
if ([deviceModel isEqualToString:@"iPad5,1"])      return @"iPad mini 4 (WiFi)";
if ([deviceModel isEqualToString:@"iPad5,2"])      return @"4th Gen iPad mini (WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad5,3"])      return @"iPad Air 2 (WiFi)";
if ([deviceModel isEqualToString:@"iPad5,4"])      return @"iPad Air 2 (Cellular)";
if ([deviceModel isEqualToString:@"iPad6,3"])      return @"iPad Pro (9.7 inch, WiFi)";
if ([deviceModel isEqualToString:@"iPad6,4"])      return @"iPad Pro (9.7 inch, WiFi+LTE)";
if ([deviceModel isEqualToString:@"iPad6,7"])      return @"iPad Pro (12.9 inch, WiFi)";
if ([deviceModel isEqualToString:@"iPad6,8"])      return @"iPad Pro (12.9 inch, WiFi+LTE)";
if ([deviceModel isEqualToString:@"iPad6,11"])      return @"iPad (2017)";
if ([deviceModel isEqualToString:@"iPad6,12"])      return @"iPad (2017)";
if ([deviceModel isEqualToString:@"iPad7,1"])      return @"iPad Pro 2nd Gen (WiFi)";
if ([deviceModel isEqualToString:@"iPad7,2"])      return @"iPad Pro 2nd Gen (WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad7,3"])      return @"iPad Pro 10.5-inch";
if ([deviceModel isEqualToString:@"iPad7,4"])      return @"iPad Pro 10.5-inch";
if ([deviceModel isEqualToString:@"iPad7,5"])      return @"iPad 6th Gen (WiFi)";
if ([deviceModel isEqualToString:@"iPad7,6"])      return @"iPad 6th Gen (WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad7,11"])      return @"iPad 7th Gen 10.2-inch (WiFi)";
if ([deviceModel isEqualToString:@"iPad7,12"])      return @"iPad 7th Gen 10.2-inch (WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad8,1"])      return @"iPad Pro 11 inch (WiFi)";
if ([deviceModel isEqualToString:@"iPad8,2"])      return @"iPad Pro 11 inch (1TB, WiFi)";
if ([deviceModel isEqualToString:@"iPad8,3"])      return @"iPad Pro 11 inch (WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad8,4"])      return @"iPad Pro 11 inch (1TB, WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad8,5"])      return @"iPad Pro 12.9 inch 3rd Gen (WiFi)";
if ([deviceModel isEqualToString:@"iPad8,6"])      return @"iPad Pro 12.9 inch 3rd Gen (1TB, WiFi)";
if ([deviceModel isEqualToString:@"iPad8,7"])      return @"iPad Pro 12.9 inch 3rd Gen (WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad8,8"])      return @"iPad Pro 12.9 inch 3rd Gen (1TB, WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad8,9"])      return @"iPad Pro 11 inch 2nd Gen (WiFi)";
if ([deviceModel isEqualToString:@"iPad8,10"])      return @"iPad Pro 11 inch 2nd Gen (WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad8,11"])      return @"iPad Pro 12.9 inch 4th Gen (WiFi)";
if ([deviceModel isEqualToString:@"iPad8,12"])      return @"iPad Pro 12.9 inch 4th Gen (WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad11,1"])      return @"iPad mini 5th Gen (WiFi)";
if ([deviceModel isEqualToString:@"iPad11,2"])      return @"iPad mini 5th Gen";
if ([deviceModel isEqualToString:@"iPad11,3"])      return @"iPad Air 3rd Gen (WiFi)";
if ([deviceModel isEqualToString:@"iPad11,4"])      return @"iPad Air 3rd Gen";
if ([deviceModel isEqualToString:@"iPad11,6"])      return @"iPad 8th Gen (WiFi)";
if ([deviceModel isEqualToString:@"iPad11,7"])      return @"iPad 8th Gen (WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad12,1"])      return @"iPad (9th generation) Wi-Fi";
if ([deviceModel isEqualToString:@"iPad12,2"])      return @"iPad (9th generation) Wi-Fi + Cellular";
if ([deviceModel isEqualToString:@"iPad13,1"])      return @"iPad air 4th Gen (WiFi)";
if ([deviceModel isEqualToString:@"iPad13,2"])      return @"iPad air 4th Gen (WiFi+Cellular)";
if ([deviceModel isEqualToString:@"iPad13,4"])      return @"iPad Pro 11 inch 3rd Gen";
if ([deviceModel isEqualToString:@"iPad13,5"])      return @"iPad Pro 11 inch 3rd Gen";
if ([deviceModel isEqualToString:@"iPad13,6"])      return @"iPad Pro 11 inch 3rd Gen";
if ([deviceModel isEqualToString:@"iPad13,7"])      return @"iPad Pro 11 inch 3rd Gen";
if ([deviceModel isEqualToString:@"iPad13,8"])      return @"iPad Pro 12.9 inch 5th Gen";
if ([deviceModel isEqualToString:@"iPad13,9"])      return @"iPad Pro 12.9 inch 5th Gen";
if ([deviceModel isEqualToString:@"iPad13,10"])      return @"iPad Pro 12.9 inch 5th Gen";
if ([deviceModel isEqualToString:@"iPad13,11"])      return @"iPad Pro 12.9 inch 5th Gen";
if ([deviceModel isEqualToString:@"iPad13,16"])      return @"iPad Air (5th generation) Wi-Fi";
if ([deviceModel isEqualToString:@"iPad13,17"])      return @"iPad Air (5th generation) Wi-Fi + Cellular";
if ([deviceModel isEqualToString:@"iPad14,1"])      return @"iPad mini (6th generation) Wi-Fi";
if ([deviceModel isEqualToString:@"iPad14,2"])      return @"iPad mini (6th generation) Wi-Fi + Cellular";

//
if ([deviceModel isEqualToString:@"Watch1,1"])      return @"Apple Watch 38mm case";
if ([deviceModel isEqualToString:@"Watch1,2"])      return @"Apple Watch 38mm case";
if ([deviceModel isEqualToString:@"Watch2,6"])      return @"Apple Watch Series 1 38mm case";
if ([deviceModel isEqualToString:@"Watch2,7"])      return @"Apple Watch Series 1 42mm case";
if ([deviceModel isEqualToString:@"Watch2,3"])      return @"Apple Watch Series 2 38mm case";
if ([deviceModel isEqualToString:@"Watch2,4"])      return @"Apple Watch Series 2 42mm case";
if ([deviceModel isEqualToString:@"Watch3,1"])      return @"Apple Watch Series 3 38mm case (GPS+Cellular)";
if ([deviceModel isEqualToString:@"Watch3,2"])      return @"Apple Watch Series 3 42mm case (GPS+Cellular)";
if ([deviceModel isEqualToString:@"Watch3,3"])      return @"Apple Watch Series 3 38mm case (GPS)";
if ([deviceModel isEqualToString:@"Watch3,4"])      return @"Apple Watch Series 3 42mm case (GPS)";
if ([deviceModel isEqualToString:@"Watch4,1"])      return @"Apple Watch Series 4 40mm case (GPS)";
if ([deviceModel isEqualToString:@"Watch4,2"])      return @"Apple Watch Series 4 44mm case (GPS)";
if ([deviceModel isEqualToString:@"Watch4,3"])      return @"Apple Watch Series 4 40mm case (GPS+Cellular)";
if ([deviceModel isEqualToString:@"Watch4,4"])      return @"Apple Watch Series 4 44mm case (GPS+Cellular)";
if ([deviceModel isEqualToString:@"Watch5,1"])      return @"Apple Watch Series 5 40mm case (GPS)";
if ([deviceModel isEqualToString:@"Watch5,2"])      return @"Apple Watch Series 5 44mm case (GPS)";
if ([deviceModel isEqualToString:@"Watch5,3"])      return @"Apple Watch Series 5 40mm case (GPS+Cellular)";
if ([deviceModel isEqualToString:@"Watch5,4"])      return @"Apple Watch Series 5 44mm case (GPS+Cellular)";
if ([deviceModel isEqualToString:@"Watch5,9"])      return @"Apple Watch SE 40mm case (GPS)";
if ([deviceModel isEqualToString:@"Watch5,10"])      return @"Apple Watch SE 44mm case (GPS)";
if ([deviceModel isEqualToString:@"Watch5,11"])      return @"Apple Watch SE 40mm case (GPS+Cellular)";
if ([deviceModel isEqualToString:@"Watch5,12"])      return @"Apple Watch SE 44mm case (GPS+Cellular)";
if ([deviceModel isEqualToString:@"Watch6,1"])      return @"Apple Watch Series 6 40mm case (GPS)";
if ([deviceModel isEqualToString:@"Watch6,2"])      return @"Apple Watch Series 6 44mm case (GPS)";
if ([deviceModel isEqualToString:@"Watch6,3"])      return @"Apple Watch Series 6 40mm case (GPS+Cellular)";
if ([deviceModel isEqualToString:@"Watch6,4"])      return @"Apple Watch Series 6 44mm case (GPS+Cellular)";

//
if ([deviceModel isEqualToString:@"AppleTV2,1"])      return @"Apple TV 2";
if ([deviceModel isEqualToString:@"AppleTV3,1"])      return @"Apple TV 3";
if ([deviceModel isEqualToString:@"AppleTV3,2"])      return @"Apple TV 3";
if ([deviceModel isEqualToString:@"AppleTV5,3"])      return @"Apple TV 4";


    return deviceModel;
}
@end
